import { Injectable } from '@angular/core';
import { CanDeactivate } from '@angular/router';
import { Router } from '@angular/router';
import { LayoutComponent } from 'src/app/layouts/layout.component';
import { AuthService } from '../auth/auth.service';

@Injectable({
  providedIn: 'root'
})
export class LogoutGuard implements CanDeactivate<LayoutComponent> {
  constructor(private router: Router, private authService: AuthService) { }

  canDeactivate() {
    return this.authService.currentUser == null;
  }
}
